/**
 * @ClassName LC397
 * 整数替换
 * @Author ykx
 * @Date 2024/3/25 17:54
 * @Version 1.0
 */
public class LC397 {
    public int integerReplacement(int n) {
        int count = 0;
        while (n > 1) {
            if (n % 2 == 0) {
                n = n / 2;
            } else {
                n = n - 1;
            }
            count++;
        }
        return count;
    }
}
